/**
 * Created by lvyue on 15/1/26.
 */
/**
 *String 判断起始的函数
 * @param {Object} str
 */
String.prototype.startWith = function (str) {
    if (str && this) {
        if (str.length > this.length) {
            return false;
        }
        if (this.substring(0, str.length) === str) {
            return true;
        }
    }
    return false;
};

/**
 * String 判断结尾
 * @param {Object} str
 */
String.prototype.endWith = function (str) {
    if (str && this) {
        if (str.length > this.length) {
            return false;
        }
        if (this.substring(this.length - str.length, this.length) === str) {
            return true;
        }
    }
    return false;
};
/**
 * 去除两端空格
 */
String.prototype.trim = function () {
    try {
        return this.replace(/(^\s*)|(\s*$)/g, "");
    }
    catch (e) {
    }
    return "";
};